<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/easyui/1.4.1/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="/easyui/1.4.1/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/easyui/1.4.1/datagrid-detailview.js"></script>
    <script type="text/javascript" src="/easyui/1.4.1/locale/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" type="text/css" href="/easyui/1.4.1/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/easyui/1.4.1/themes/icon.css">
</head>
<script>
    function format(value,row,index){
        console.log(index)
        return "<a href = 'javascript:void(0)'>详情</a>"
    }
</script>
<body>
<table id="grids" toolbar="#toolbar"
       noheader="true" border="false" striped="true"
       fitColumns="true" singleSelect="true"
       pagination="true" multiSort = "true">
    <thead>
    <tr>
        <th data-options="field:'ck',checkbox:true"></th>
        <th field="id" width="150px" sortable="true">ID</th>
        <th field="pid" width="100px" sortable="true">pid</th>
        <th field="title" width="150px" formatter="" sortable="true">分类标题</th>
        <th field="type" width="150px" formatter="" sortable="">类型</th>
        <th field="count" width="150px" formatter="" sortable="true">数量</th>
        <th field="opion" width="150px" formatter="format" sortable="">操作</th>
        <!--<th field="hconame" width="150px" formatter="" sortable="">医院</th>
        <th field="dept1" width="150px" formatter="" sortable="">科室</th>
        <th field="content" width="150px" formatter="" sortable="">材料名称</th>
        <th field="review" width="150px" formatter="" sortable="">反馈</th>
        <th field="gmtCreate" width="150px" formatter="converTime" sortable="">反馈时间</th>-->
    </tr>
    </thead>
</table>
</body>
<script>
    var pagesize = 5;
    $(function () {
        load();
    })
    function load() {
        $('#grids').datagrid({
            idField: 'id',
            url: "test",
            pageSize: pagesize,
            onSelect:function(rowIndex, rowData){
                console.log("选中操作:"+rowData.id)
            },
            onDblClickCell: function(index,field,value){
                $(this).datagrid('beginEdit', index);
                var ed = $(this).datagrid('getEditor', {index:index,field:field});
                $(ed).focus();
            }
        })
    }
</script>
</html>